package com.ljwy.gun.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.ljwy.gun.R;
import com.ljwy.gun.bean.Device;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class BTAdapter extends BaseViewAdapter<Device> {
    public BTAdapter(Context context, List<Device> list) {
        super(context, list);
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder;
        if (view == null) {
            view = View.inflate(context, R.layout.adapter_device, null);
            holder = new ViewHolder(view);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        Device device = list.get(i);
        holder.text.setText(device.getAddress());
        return view;
    }

    static
    class ViewHolder {
        @BindView(R.id.text)
        TextView text;
        @BindView(R.id.text_sign)
        TextView text_sign;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
